<style lang="less">
    // .main .content-wrapper {
    //   padding: 0;
    //   height: calc(100% - 80px);
    //   overflow: auto;
    // }
    .card_style {
        height: 100%;
        width: 100%;
        overflow: hidden;
        .ivu-card-body {
            padding: 0px;
        }
    }
    .page_style {
        margin-top: 10px;
        text-align: right;
    }
    .bench_search {
        margin-bottom: 10px;
    }
    .nopadding .ivu-table-cell {
        padding: 0px 0px;
    }
    .item1{
        height: 42px;
        line-height: 40px;
    }
</style>
<template>
    <Card class="card_style" :bordered="false" :dis-hover="true">
        <Tabs value="name1" @on-click="changeTab" v-model="tab_index">
            <TabPane :label="'待咨询'" name="" >
                <Row class="bench_search">
                </Row>
                <div style="margin-top: 20px">
                    <Table border :columns="columns1" :data="datalist"></Table>
                </div>
                <div  class="page">
                    <Page :total="totalnum" :current="currentPageNo" :page-size="currentPageSize" @on-change="change" class="page_style"/>
                </div>
            </TabPane>
            <TabPane :label="'咨询已通过'" name="" >
                <Row class="bench_search">
                </Row>
                <div style="margin-top: 20px">
                    <Table border :columns="columns2" :data="datalist"></Table>
                </div>
                <div  class="page">
                    <Page :total="totalnum" :current="currentPageNo" :page-size="currentPageSize" @on-change="change" class="page_style"/>
                </div>
            </TabPane>
            <TabPane :label="'咨询已驳回'" name="" >
                <Row class="bench_search">
                </Row>
                <div style="margin-top: 20px">
                    <Table border :columns="columns3" :data="datalist"></Table>
                </div>
                <div  class="page">
                    <Page :total="totalnum" :current="currentPageNo" :page-size="currentPageSize" @on-change="change" class="page_style"/>
                </div>
            </TabPane>
        </Tabs>
        <Modal v-model="modal" title="编辑基本信息" width="700" cancel-text="关闭"
               @on-ok="ok111(paramData)" @on-cancel="modal = false" ok-text="确定" style="position:relative;">
            <Form ref="paramData" :model="paramData"  >
                <Row class="item1">
                    <Col span="5" style="text-align: center" class="">类型:</Col>
                    <Col span="12">
                        <Input v-model="paramData.knowledge_type" placeholder=""></Input>
                    </Col>
                </Row>
                <Row class="item1">
                    <Col span="5" style="text-align: center" class="">标题:</Col>
                    <Col span="12">
                        <Input v-model="paramData.knowledge_title" placeholder=""></Input>
                    </Col>
                </Row>
                <Row class="item1" style="height:auto;line-height:auto">
                    <Col span="5" style="text-align: center" class="">内容:</Col>
                    <Col span="12">
                        <Input v-model="paramData.knowledge_content" type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder=""></Input>
                    </Col>
                </Row>
                <!-- <Row class="item1">
                  <Col span="5" style="text-align: center" class="">发布人:</Col>
                  <Col span="12">
                    <Input v-model="paramData.create_by" placeholder=""></Input>
                  </Col>
                </Row> -->
            </Form>
        </Modal>
        <Modal v-model="modal1" title="详情" width="700" cancel-text="关闭"
               @on-cancel="modal = false" ok-text="确定" style="position:relative;">
            <Form ref="paramData" :model="paramData"  >
                <Row class="item1">
                    <Col span="6" style="text-align: right" class="">类型:</Col>
                    <Col span="12" offset="1">{{paramData.knowledge_type}}</Col>
                </Row>
                <Row class="item1">
                    <Col span="6" style="text-align: right" class="red-name">标题:</Col>
                    <Col span="12" offset="1">{{paramData.knowledge_title}}</Col>
                </Row>
                <Row class="item1" style="height:auto;line-height:auto">
                    <Col span="6" style="text-align: right" class="">内容:</Col>
                    <Col span="12" offset="1">{{paramData.knowledge_content}}</Col>
                </Row>
                <Row class="item1">
                    <Col span="6" style="text-align: right" class="red-name">发布人:</Col>
                    <Col span="12" offset="1">{{paramData.create_by}}</Col>
                </Row>
            </Form>
        </Modal>
    </Card>
</template>

<script>
// import { date2str } from '@/api/enterprise'
import { getCompanyMsgList } from '@/api/demo'
export default {
  data () {
    return {
      companyCode: '',
      modal: false,
      modal1: false,
      modal2: false,
      modal6: false,
      pic_preview_mol: false,
      modal_loading: false,
      currentPageNo: 1,
      currentPageSize: 10,
      totalnum: 0,
      dateTime: '',
      tab_index: 0,
      num: 0,
      num1: 0,
      num2: 0,
      num3: 0,
      searchDate: {},
      searchInfo: {
        knowledge_type: ''
      },
      paramData2: {},
      paramData: {},
      searchData: {},
      datalist: [],
      columns1: [
        {
          title: '序号',
          type: 'index',
          width: 60,
          align: 'center'

        },
        {
          title: '企业名称',
          key: 'company_name',
          align: 'center',
          width: 260

        },
        {
          title: '企业类型',
          key: 'company_type',
          align: 'center',
          width: 170
        },
        {
          title: '项目名称',
          key: 'contact_name',
          align: 'center',
          width: 180
        },
        {
          title: '项目编号',
          key: 'contact_mobile',
          align: 'center',
          width: 150
        },
        {
          title: '操作时间',
          key: 'create_time',
          align: 'center',
          width: 140
        },
        {
          title: '操作',
          key: 'action',
          width: 180,
          align: 'center',
          render: (h, params) => {
            let temp = []
            temp.push(
              h('Button', {
                props: {
                  type: 'primary',
                  size: 'small'
                },
                style: { marginRight: '5px' },
                on: {
                  click: () => {
                    this.modal = true
                  }
                }
              }, '查看详情')
            )
            return h('div', temp)
          }
        }
      ],
      columns2: [
        {
          title: '序号',
          type: 'index',
          width: 60,
          align: 'center'

        },
        {
          title: '企业名称',
          key: 'company_name',
          align: 'center',
          width: 260

        },
        {
          title: '企业类型',
          key: 'company_type',
          align: 'center',
          width: 170
        },
        {
          title: '项目名称',
          key: 'contact_name',
          align: 'center',
          width: 180
        },
        {
          title: '项目编号',
          key: 'contact_mobile',
          align: 'center',
          width: 150
        },
        {
          title: '项目状态',
          key: 'contact_mobile',
          align: 'center',
          width: 150
        },
        {
          title: '操作时间',
          key: 'create_time',
          align: 'center',
          width: 140
        }
      ],
      columns3: [
        {
          title: '序号',
          type: 'index',
          width: 60,
          align: 'center'

        },
        {
          title: '企业名称',
          key: 'company_name',
          align: 'center',
          width: 260

        },
        {
          title: '企业类型',
          key: 'company_type',
          align: 'center',
          width: 170
        },
        {
          title: '项目名称',
          key: 'contact_name',
          align: 'center',
          width: 180
        },
        {
          title: '项目编号',
          key: 'contact_mobile',
          align: 'center',
          width: 150
        },
        {
          title: '操作时间',
          key: 'create_time',
          align: 'center',
          width: 140
        },
        {
          title: '驳回原因',
          key: 'create_time',
          align: 'center',
          width: 140
        }
      ]
    }
  },
  methods: {
    findCompanyList (state) {
      let data = {
        pageNo: this.currentPageNo,
        pageSize: this.currentPageSize,
        state: state
      }
      getCompanyMsgList(data).then(ret => {
        if (ret.data.errcode === 0) {
          console.log(ret.data.data)
          this.datalist = ret.data.data.results
        }
      })
    },
    ok111 () {

    },
    ok () {
      /* this.$Message.info('Clicked ok') */
    },
    cancel () {
      /* this.$Message.info('Clicked cancel') */
    },
    show3 () {
      console.log(this.value5)
    },
    censusregister (param) {
      console.log('22222222222222222222')
      console.log(param)
      let data8 = { 'IDcard': param.cardno, 'Name': param.name }
      getRegisterInfo(data8).then(ret => {
        console.log(ret)
        if (ret.data.errcode === 0) {
          if (ret.data.data.result === '-1') {
            this.register = '非沈阳户籍地'
          }
          if (ret.data.data.result === '0') {
            this.register = '沈阳有效户籍'
          }
          if (ret.data.data.result === '1') {
            this.register = '户籍已删除'
          }
          if (ret.data.data.result === '2') {
            this.register = '户籍被加锁'
          }
          if (ret.data.data.result === '3') {
            this.register = '重错号'
          }
          if (ret.data.data.result === '4') {
            this.register = '跨市重错号'
          }
          if (ret.data.data.result === '6') {
            this.register = '持证'
          }
          if (ret.data.data.result === '7') {
            this.register = '在逃犯'
          }
          if (ret.data.data.result === '8') {
            this.register = '户籍已迁出沈阳'
          }
          if (ret.data.data.result === '9') {
            this.register = '死亡'
          }

          return
        }
        this.$Modal.error({
          title: '错误',
          content: ret.data.errmsg
        })
      })
    },
    // 查询详情
    getUserDbInfo (item) {
      this.getUserInfo(item.cardno)
      this.getItemInfo(item.code)
      this.getLowPerson(item.cardno)
      this.getDisablePerson(item.cardno)
    },
    changemodel (data) {
      this.modal1 = true
      console.log(data)
      this.obj = data
    },
    change (pageNo) {
      this.currentPageNo = pageNo
      // let params = {
      //   name: this.applyname,
      //   state: this.tab_info[1][this.tab_index]
      // }
      // if (this.applytime[0]) params.start_time = date2str(this.applytime[0])
      // if (this.applytime[1]) params.end_time = date2str(this.applytime[1])
      // this.all('')
    },
    // 切换tab页
    changeTab (name) {
      this.currentPageNo = 1
      this.currentPageSize = 10
      console.log(this.tab_index, 'tab页')
      this.findCompanyList(this.tab_index)
    }
  },
  mounted () {
    this.findCompanyList()
  }
}
</script>

<style scoped>

</style>
